// 测试折扣功能逻辑
function testDiscountFunction() {
  console.log('=== 折扣功能测试 ===')
  
  // 测试场景1：有折扣的情况
  console.log('\n测试场景1：70%折扣')
  const originalPrice = 100
  const discount = 70
  const hasDiscount = discount && discount > 0 && discount < 100
  const actualPayMoney = hasDiscount ? (originalPrice * discount / 100).toFixed(2) : originalPrice
  
  console.log(`原价: ¥${originalPrice}`)
  console.log(`折扣: ${discount}%`)
  console.log(`实际支付: ¥${actualPayMoney}`)
  console.log(`节省: ¥${(originalPrice - actualPayMoney).toFixed(2)}`)
  
  // 测试场景2：无折扣的情况
  console.log('\n测试场景2：无折扣')
  const originalPrice2 = 100
  const discount2 = false
  const hasDiscount2 = discount2 && discount2 > 0 && discount2 < 100
  const actualPayMoney2 = hasDiscount2 ? (originalPrice2 * discount2 / 100).toFixed(2) : originalPrice2
  
  console.log(`原价: ¥${originalPrice2}`)
  console.log(`折扣: ${discount2}`)
  console.log(`实际支付: ¥${actualPayMoney2}`)
  
  // 测试场景3：100%折扣（免费）
  console.log('\n测试场景3：100%折扣（免费）')
  const originalPrice3 = 100
  const discount3 = 100
  const hasDiscount3 = discount3 && discount3 > 0 && discount3 < 100
  const actualPayMoney3 = hasDiscount3 ? (originalPrice3 * discount3 / 100).toFixed(2) : originalPrice3
  
  console.log(`原价: ¥${originalPrice3}`)
  console.log(`折扣: ${discount3}%`)
  console.log(`实际支付: ¥${actualPayMoney3}`)
  console.log(`是否免费: ${actualPayMoney3 == 100}`)
  
  // 测试场景4：80%折扣
  console.log('\n测试场景4：80%折扣')
  const originalPrice4 = 50
  const discount4 = 80
  const hasDiscount4 = discount4 && discount4 > 0 && discount4 < 100
  const actualPayMoney4 = hasDiscount4 ? (originalPrice4 * discount4 / 100).toFixed(2) : originalPrice4
  
  console.log(`原价: ¥${originalPrice4}`)
  console.log(`折扣: ${discount4}%`)
  console.log(`实际支付: ¥${actualPayMoney4}`)
  console.log(`节省: ¥${(originalPrice4 - actualPayMoney4).toFixed(2)}`)
  
  console.log('\n=== 测试完成 ===')
}

// 运行测试
testDiscountFunction() 